package com.dxy.yesas2020goals.study.partone.disignpattern.factorypattern.simplefactory;

/**
 * @author victorydeng
 * @Classname KouZhaoTest
 * @Description TODO
 * @Date 2020/2/27 9:45
 * @Created by victorydeng
 */
public class KouZhaoTest {

  public static void main(String[] args) {

    //使用名字作为形参匹配
    // -------------------使用名字匹配 start
//    KouZhaoFactory factory = new KouZhaoFactory();
//    KN94KouZhao kn94 = (KN94KouZhao) factory.create("KN94");
//    KN95KouZhao kn95 = (KN95KouZhao) factory.create("KN95");
//    KF94KouZhao kf94 = (KF94KouZhao) factory.create("KF94");
//    kn94.protect();
//    kn95.protect();
//    kf94.protect();
//
// ------------------使用名字匹配 end

// -------------------使用反射匹配 end
    KouZhaoFactory factory = new KouZhaoFactory();
    KN94KouZhao kn94 = (KN94KouZhao) factory.create(KN94KouZhao.class);
    KN95KouZhao kn95 = (KN95KouZhao) factory.create(KN95KouZhao.class);
    KF94KouZhao kf94 = (KF94KouZhao) factory.create(KF94KouZhao.class);
    kn94.protect();
    kn95.protect();
    kf94.protect();
    // -------------------使用反射匹配 end


  }

}
